package com.muy.redis.view.window.redis.configuration;

import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.muy.redis.common.configuration.ProjectConfiguration;
import com.muy.redis.view.window.redis.bean.MrRedisConnectionParam;
import lombok.Getter;
import lombok.Setter;

import java.util.LinkedList;
import java.util.List;

/**
 * @Author jiyanghuang
 * @Date 2023/9/15 20:19
 */
@State(
        name = "MrRedisConfiguration",
        storages = {
                @Storage(file = "$PROJECT_CONFIG_DIR$/MrRedisSettings.xml")
        }
)
public class MrRedisConfiguration extends ProjectConfiguration<MrRedisConfiguration, MrRedisConnectionParam> {

    @Getter
    @Setter
    private List<MrRedisConnectionParam> entrances = new LinkedList<>();

    public static MrRedisConfiguration getInstance(Project project) {
        return project.getService(MrRedisConfiguration.class);
    }
}
